*&---------------------------------------------------------------------*
*& 包含               ZFIU020_CLS
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
*       CLASS lcl_events DEFINITION
*----------------------------------------------------------------------*
* SALV Event Handler Definition                                        *
*----------------------------------------------------------------------*
CLASS GCL_EVENTS_HANDLER DEFINITION.
  PUBLIC SECTION.
    METHODS:
      ON_LINK_CLICK FOR EVENT LINK_CLICK  "Hotspot Handler
        OF CL_SALV_EVENTS_TABLE
        IMPORTING ROW COLUMN,

      ON_USER_COMMAND FOR EVENT ADDED_FUNCTION OF CL_SALV_EVENTS
        IMPORTING E_SALV_FUNCTION.
ENDCLASS.                    "lcl_events DEFINITION
*
*----------------------------------------------------------------------*
*       CLASS lcl_events IMPLEMENTATION
*----------------------------------------------------------------------*
*  SAL Event Handler Methods                                           *
*----------------------------------------------------------------------*
CLASS GCL_EVENTS_HANDLER IMPLEMENTATION.
  METHOD ON_LINK_CLICK.
    READ TABLE GT_RESULT INTO DATA(LS_RESULT) INDEX ROW.
    IF SY-SUBRC = 0.
      CASE COLUMN.
        WHEN 'JSDDH'.
          SET PARAMETER ID 'ZJSDDH' FIELD LS_RESULT-JSDDH.
          CALL TRANSACTION 'ZFIU019_01' AND SKIP FIRST SCREEN.

        WHEN 'DOCID'.

          IF LS_RESULT-DOCID IS NOT INITIAL.
            DATA LV_MSG2(80) TYPE C.

            CALL FUNCTION '/OPT/VIM_DISPLAY_DOCUMENT'
              EXPORTING
                DOCID                 = LS_RESULT-DOCID
                POPUP                 = 'X'
              EXCEPTIONS
                INVALID_DOCUMENT      = 1
                SYSTEM_FAILURE        = 2 MESSAGE LV_MSG2
                COMMUNICATION_FAILURE = 3
                OTHERS                = 4.
            IF SY-SUBRC EQ 1.
              MESSAGE I075(/OPT/VIM_M_CLASS).
            ELSEIF SY-SUBRC EQ 2 OR
                   SY-SUBRC EQ 3.
              MESSAGE LV_MSG2 TYPE 'S' DISPLAY LIKE 'E'.

            ELSEIF SY-SUBRC NE 0.
              MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
          ENDIF.

        WHEN 'BELNR_MM'.

          CHECK NOT LS_RESULT-BELNR_MM IS INITIAL.
          SET PARAMETER ID 'RBN' FIELD LS_RESULT-BELNR_MM+0(10).
          SET PARAMETER ID 'GJR' FIELD LS_RESULT-BELNR_MM+10(4).

          CALL FUNCTION 'AUTHORITY_CHECK_TCODE'             "2334943
            EXPORTING
              TCODE  = 'MIR4'
            EXCEPTIONS
              OK     = 1
              NOT_OK = 2
              OTHERS = 3.

          IF SY-SUBRC <> 1.
            MESSAGE E172(00) WITH 'MIR4'.
          ELSE.
            CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
          ENDIF.

        WHEN 'BELNR'.

          CHECK NOT LS_RESULT-BELNR IS INITIAL.
          SET PARAMETER ID 'BLN' FIELD LS_RESULT-BELNR.
          SET PARAMETER ID 'GJR' FIELD LS_RESULT-GJAHR.
          SET PARAMETER ID 'BUK' FIELD LS_RESULT-BUKRS.
          CALL FUNCTION 'AUTHORITY_CHECK_TCODE'             "2334943
            EXPORTING
              TCODE  = 'FB03'
            EXCEPTIONS
              OK     = 1
              NOT_OK = 2
              OTHERS = 3.

          IF SY-SUBRC <> 1.
            MESSAGE E172(00) WITH 'FB03'.
          ELSE.
            CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
          ENDIF.



        WHEN OTHERS.
      ENDCASE.
    ENDIF.

  ENDMETHOD.

  METHOD ON_USER_COMMAND.
    CASE E_SALV_FUNCTION.
      WHEN '&ZREFRESH'.
        PERFORM FRM_GET_DATA.

        DATA:
          LR_COLUMNS    TYPE REF TO CL_SALV_COLUMNS_TABLE.

        LR_COLUMNS = GR_TABLE->GET_COLUMNS( ).
        LR_COLUMNS->SET_OPTIMIZE( 'X' ).
        GR_TABLE->REFRESH( ).

      WHEN '&ZTOVIM'.
        CALL TRANSACTION '/OPT/VIM_WP'.

*      WHEN 'ZTOVIMRP'.
*        CALL TRANSACTION '/OPT/VIM_VA2'.
      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.
  "on_link_click
ENDCLASS.                    "lcl_events IMPLEMENTATION

DATA: GR_EVENTS_HANDLER TYPE REF TO GCL_EVENTS_HANDLER.
